package cn.tedu.oa.common.vo;

/**
 * 通过此对象封装控制层的数据
 */
public class JsonResult {
    /*状态码：0 正确 1 错误*/
    private int code = 0;
    /*状态码对应的信息*/
    private String msg = "ok";
    /*总记录数*/
    private int count;
    /*封装数据*/
    private Object data;

    public JsonResult() {
    }

    public JsonResult(String message) {
        this.msg = message;
    }

    public JsonResult(Object data) {
        this.data = data;
    }

    public JsonResult(Throwable e){
        this.code =1; //错误信息
        this.msg =e.getMessage();
    }

    public JsonResult(Integer state,String message){
        this.code =state;
        this.msg =message;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
